const path = require('path');

function resolve(dir) {
    return path.join(__dirname, dir);
}

module.exports = {
    publicPath: './',
    lintOnSave: false,
    devServer: {
        // can be overwritten by process.env.HOST
        host: '0.0.0.0',
        port: 8080
    },
    chainWebpack: config => {
        config.resolve.alias
            .set('@', resolve('src'))
            .set('@v', resolve('src/views'))
            .set('src', resolve('src'))
            .set('common', resolve('src/common'))
            .set('components', resolve('src/components'));
    },
    pluginOptions: {
        electronBuilder: {
            builderOptions: {
                "productName": "灵石小课", //项目名，也是生成的安装文件名，即aDemo.exe
                "appId": "com.example.app",
                "copyright": "Copyright © 2020", //版权信息  
                "directories": {
                    "output": "./dist" //输出文件路径  
                },
                mac: {
                    icon: './public/app.png'
                },
                win: {
                    "icon": "./public/app.ico",
                    "sign": "./customSign.js",
                    "target": [{
                        "target": "nsis", //利用nsis制作安装程序 
                        "arch": [
                            "x64", //64位
                            // "ia32" //32位
                        ]
                    }]
                },
                linux: { // linux
                    icon: './public',
                    "target": [
                        "AppImage"
                    ]
                },
                "nsis": {
                    // "oneClick": false, // 是否一键安装
                    "allowElevation": true, // 允许请求提升。 如果为false，则用户必须使用提升的权限重新启动安装程序。
                    "allowToChangeInstallationDirectory": false, // 允许修改安装目录
                    "perMachine": true,
                    "installerIcon": "./public/app.ico", // 安装图标
                    "uninstallerIcon": "./public/app.ico", //卸载图标
                    "installerHeaderIcon": "./public/app.ico", // 安装时头部图标
                    "createDesktopShortcut": true, // 创建桌面图标
                    "createStartMenuShortcut": true, // 创建开始菜单图标
                    "shortcutName": "灵石小课", // 图标名称
                }


            }
        }
    }

};